//// src/main/java/com/training/service/LearningProgressService.java
//package com.training.service;
//
//import com.training.entity.LearningProgress;
//import com.training.repository.LearningProgressRepository;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//import java.time.LocalDateTime;
//import java.util.Optional;
//
//@Service
//public class LearningProgressService {
//
//    @Autowired
//    private LearningProgressRepository progressRepository;
//
//    // 记录或更新学习进度
//    public void recordProgress(Long studentId, Long courseId, Long chapterId, Double progressSeconds) {
//        LearningProgress progress = progressRepository.findByStudentIdAndChapterId(studentId, chapterId)
//                .orElse(new LearningProgress());
//
//        progress.setStudentId(studentId);
//        progress.setCourseId(courseId);
//        progress.setChapterId(chapterId);
//        progress.setProgressSeconds(progressSeconds);
//        progress.setLastUpdateTime(LocalDateTime.now());
//
//        progressRepository.save(progress);
//    }
//
//    // 获取学习进度
//    public Optional<LearningProgress> getProgress(Long studentId, Long chapterId) {
//        return progressRepository.findByStudentIdAndChapterId(studentId, chapterId);
//    }
//
//    // TODO: 实现课程活跃度统计
//    // public List<CourseActivityDto> getCourseActivityStats() { ... }
//}